Skip to content

fix(dev): source watcher ignores the package build's .compile- scratch dir (red main) - #669

Merged
ScriptedAlchemy merged 2 commits into
mainfrom
hotfix/watcher-compile-scratch
Sep 6, 2026
Merged

fix(dev): source watcher ignores the package build's .compile- scratch dir (red main)#669
ScriptedAlchemy merged 2 commits into
mainfrom
hotfix/watcher-compile-scratch

Conversation

@ScriptedAlchemy

@ScriptedAlchemy ScriptedAlchemy commented Sep 6, 2026

Copy link
Copy Markdown
Owner

Fixes red main (Verify (integration-2) at 7e56517756, route-invocation-dev-server.test.ts ×2).

Root cause

#656 made the package build compile into a second scratch sibling of the output root, .<output>.compile-XXXXXX, beside the existing .<output>.stage-XXXXXX. The agent-bundle dev source watcher (dev/watcher.ts, isOutputStagingPath) only knew the .stage- prefix, so the compile directory's creation and removal counted as a source change: every dist/ package build inside the dev server invalidated and republished the epoch it had just produced (same source revision, new epoch id). Anything pinned to the first epoch — the parity fixtures' operator .env, an invocation queued against it — then ran under, or was compared against, the second one (operator: 'missing', pluginRoot epoch mismatch).

Fix

isOutputStagingPath recognises both .<output>.stage- and .<output>.compile-. dev-watcher.test.ts emits addDir/add/unlinkDir for a .dist.compile-XXXXXX tree and asserts no invalidation (red without the fix: failedTests: 1, the compile paths appear in paths).

Gates (local merge gate, AGENTS.md #662; branch = origin/main 7e56517756 + this commit)

pnpm build && pnpm typecheck && pnpm lint      # ok
pnpm test:unit                                 # 4272 passed, 0 failed
AGENT_BUNDLE_WORKBENCH_PREBUILT=1 AGENT_BUNDLE_PACKAGE_PREBUILT=1 pnpm exec rstest --config rstest.integration.config.ts \
  packages/agent-bundle/tests/route-invocation-dev-server.test.ts packages/agent-bundle/tests/dev-workbench.test.ts \
  packages/agent-bundle/tests/dev-package-build.test.ts        # 37 passed, 0 failed

No website change (internal watcher rule). Changeset: patch.

Not fixed here

The same main run also fails route-register-typegen.test.ts ("Type 'false' does not satisfy the constraint 'true'") and three prepack.test.ts cases (zod/vendored dependency findings, document.files is not iterable) — these reproduce at 45beb54792 (#656) / 7e56517756 (#665) and are independent of this watcher rule; reported to their authors on #600.

Self-review

Reviewer: Claude Fable 5.1 Thinking High (read-only, diff vs origin/main). Findings: (1) prefix derivation matches package-build.ts:389-392/build.ts:695 for nested and default outputs — VERIFIED; (2) no other in-root scratch directory left unhandled (node_modules/.agent-bundle-dts- and .agent-bundle/** are excluded by directory name) — VERIFIED; (3) a shared prefix helper is a reasonable follow-up, not a blocker for a hotfix — accepted; (4) changeset ended in the literal (#PR) — fixed to (#669). Verdict: MERGE.

@changeset-bot

changeset-bot Bot commented Sep 6, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f8d40d9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
agent-bundle Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@pkg-pr-new

pkg-pr-new Bot commented Sep 6, 2026

Copy link
Copy Markdown
npm i https://pkg.pr.new/ScriptedAlchemy/agent-bundle@669
npm i https://pkg.pr.new/ScriptedAlchemy/agent-bundle/create-agent-bundle@669
npm i https://pkg.pr.new/ScriptedAlchemy/agent-bundle/rsc-markdown-stream@669
npm i https://pkg.pr.new/ScriptedAlchemy/agent-bundle/@agent-bundle/runtime@669

commit: fde8424

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant